﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="MainFrame.aspx.cs" Inherits="RN.ERP.Web.MainFrame" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>
        <%=PageTitle %></title>
    <meta http-equiv="x-ua-compatible" content="ie=8" />
    <script type="text/javascript" src="Scripts/jquery.min.js"></script>
    <script type="text/javascript" src="Scripts/ligerUI/js/ligerui.min.js"></script>
    <script type="text/javascript" src='Scripts/Message/js/require.js'></script>
    <link rel="Stylesheet" type="text/css" href="Scripts/ligerUI/skins/Aqua/css/ligerui-all.css" />
    <link id="myStyleSheet" runat="server" rel="stylesheet" type="text/css" />
    <link href="Scripts/ligerUI/skins/Gray/css/layout.css" rel="stylesheet" type="text/css" />
    <link href="Scripts/ligerUI/skins/Gray/css/tab.css" rel="stylesheet" type="text/css" />
    <link href="Scripts/ligerUI/skins/ligerui-icons.css" rel="stylesheet" type="text/css" />
    <style type="text/css">
        #pageloading
        {
            position: absolute;
            left: 0px;
            top: 0px;
            width: 100%;
            height: 100%;
            z-index: 99999;
            background: white url('Images/loadingAnimation.gif') no-repeat center;
        }
        #wrapper-250
        {
            width: 170px;
            margin: 0 auto;
        }
        #msgCountor, #chatCountor
        {
            position: relative;
            top: -22px;
            left: 17px;
            color: red;
            font-weight: bold;
            cursor: pointer;
            font: menu;
        }
    </style>
    <script type="text/javascript">
        var tab = null;
        var accordion = null;
        var tree = null;
        var systemID = '<%=SystemID %>';

        $(function () {
            $(".menu a:eq(0)").click(function () {
                //退出按钮
                if (confirm('确定退出系统？')) {
                    if (systemID == 95) {
                        window.location.href = 'Handlers/LogoutHandler.ashx?LoginPageUrl=~/LoginExpert.aspx';
                    }
                    if (systemID == 101) {
                        window.location.href = 'Handlers/LogoutHandler.ashx?LoginPageUrl=~/LCLogin.aspx';
                    }
                    else {
                        window.location.href = 'Handlers/LogoutHandler.ashx';
                    }
                }
            });

            //布局
            $("#layout1").ligerLayout({ leftWidth: 190, height: '100%', space: 4, onHeightChanged: f_heightChanged });

            var height = $(".l-layout-center").height();

            //Tab
            $("#framecenter").ligerTab({ height: height });

            //面板
            $("#accordion1").ligerAccordion({ height: height - 24, speed: null });

            $(".l-link").hover(function () {
                $(this).addClass("l-link-over").addClass({ backgroundColor: "#888888" });
            }, function () {
                $(this).removeClass("l-link-over").removeClass({ backgroundColor: "#888888" });
            });

            //树
            if (systemID == 97 || systemID == 95) {
                createTreeNode();
            } else {

                $("#tree1").ligerTree({
                    url: "handlers/menuhandler.ashx",
                    checkbox: false,
                    slide: false,
                    nodeWidth: 120,
                    attribute: ['nodename', 'url'],
                    onSelect: function (node) {
                        if (!node.data.url) return;
                        var tabid = $(node.target).attr("tabid");
                        if (!tabid) {
                            tabid = new Date().getTime();
                            $(node.target).attr("tabid", tabid)
                        }
                        f_addTab(tabid, node.data.text, node.data.url);
                    }
                });
            }

            tab = $("#framecenter").ligerGetTabManager();
            accordion = $("#accordion1").ligerGetAccordionManager();
            tree = $("#tree1").ligerGetTreeManager();
            $("#pageloading").hide();

            $(".a_qq").click(function () {
                $("#divQQ").css("display", "block");
            });
        });

        function createTreeNode() {
            $.getJSON("handlers/menuhandler.ashx", { random: Math.random() }, function (data) {
                $("#menu").empty();
                var htmlstr = '';
                $.each(data, function (itemsIndex, item) {
                    htmlstr += "<li class='files' ><a href='#'>" + item.text + "</a>";
                    if (item.children && item.children.length > 0) {
                        htmlstr += "<ul  class='sub-menu' >";
                        $.each(item.children, function (index, item_sub) {
                            if (item_sub.text == "项目库管理") {
                                htmlstr += "<li onclick='Do();'> <a href='#'> " + item_sub.text + "</a></li>";
                            }
                            else {
                                htmlstr += "<li onclick='jump(\"" + itemsIndex + index + "\",\"" + item_sub.text + "\",\"" + item_sub.url + "\");'> <a href='#'> " + item_sub.text + "</a></li>";
                            }
                        });
                        htmlstr += "</ul>";

                    }
                    htmlstr += "</li>";
                });

                $('#menu').append(htmlstr);

                // Store variables
                var accordion_head = $('.accordion > li > a'),
			    accordion_body = $('.accordion li > .sub-menu');
                // Open the first tab on load
                accordion_head.first().addClass('active').next().slideDown('normal');

                // Click function
                accordion_head.live('click', function (event) {
                    event.preventDefault();
                    if (!$(this).hasClass('active')) {
                        accordion_body.slideUp('normal');
                        $(this).next().stop(true, true).slideToggle('normal');
                        accordion_head.removeClass('active');
                        $(this).addClass('active');
                    } else {
                        $(this).next().stop(true, true).slideToggle('normal');
                        $(this).removeClass('active');
                    }
                });
            })
        };
        function jump(tabid, text, url) {
            f_addTab(tabid, text, url);
        }
        function f_heightChanged(options) {
            if (tab)
                tab.addHeight(options.diff);
            if (accordion && options.middleHeight - 24 > 0)
                accordion.setHeight(options.middleHeight - 24);
        }
        function f_addTab(tabid, text, url) {

            tab.addTabItem({ tabid: tabid, text: text, url: url });
        }

        //添加Tab的扩展方法(针对点击源不在MenuTree上的情况)
        //<obj>点击源</obj>
        //<url>目标链接</url>
        function addTabExtend(obj, url, text) {
            var _self = $(obj);
            var tabid = _self.attr("tabid");
            if (!tabid) {
                tabid = new Date() - 0;
                _self.attr("tabid", tabid)
            }
            f_addTab(tabid, text, url);
        }

        function navFrame(index) {
            var tab = liger.get("framecenter");
            //alert(tab.getSelectedTabItemID());
            var tabids = tab.getTabidList("", "");
            var selectedTabid = tab.getSelectedTabItemID();
            for (var i = 0; i < tabids.length; i++) {
                if (tabids[i] == selectedTabid) {
                    frames[i].history.go(index);
                    break;
                }
            }
        }

        /*
        *使用方法:1.在打开窗口的位置-> top.setTop(ligerUI.open(...));
        *         2.关闭窗口的位置 -> top._ChildDialogClose(window,CallBackName,arg1,arg2,...)
        */
        var ChildDialog = null; //ligerUI弹窗
        var ChildDialogWin = null; //Window Object
        var ChildDialogCallBack = null; //Function Name
        var winStore = {};

        //设置子窗口和回调函数
        function setChildDialogClose(win, callback) {
            ChildDialogWin = win;
            ChildDialogCallBack = callback;
        };

        //关闭iframe中弹出的窗口
        function ChildDialogOnClose(args) {
            if (ChildDialogWin[ChildDialogCallBack]) ChildDialogWin[ChildDialogCallBack].apply(ChildDialogWin, args);
        };

        function setTop(opener, ligerWin) {
            winStore[ligerWin.jiframe[0].id] = { opener: opener, frame: ligerWin };
        };

        //窗口关闭(处理多个TOP的情况)
        function _ChildDialogClose(win, cb) {
            var ligerWin = winStore[win.name].frame;
            if (!ligerWin) return;
            var opener = winStore[win.name].opener;

            if (cb && opener[cb]) {
                var args = [].slice.call(arguments, 2);
                opener[cb].apply(opener, args);
            }
            setTimeout(function () {
                ligerWin.close();
            }, 0);
        };

        //关闭窗口
        //回调函数中需要什么参数都往里放
        function ChildDialogClose() {
            if (ChildDialogCallBack) ChildDialogOnClose(arguments);

            setTimeout(function () {
                if (ChildDialog) ChildDialog.close();
            }, 0);
        }

        //调用项目库客户端
        function Do() {
            try {
                var shell = new ActiveXObject("WScript.shell");
                var path = shell.RegRead("HKEY_CLASSES_ROOT\\SOFTWARE\\QingDaoFlyEdt\\ProjectlibraryTool\\");

                var directory = new Array();
                directory = path.split('\\');
                if (directory.length > 1) {
                    var name = directory[directory.length - 1];
                    var dir = path.substring(0, path.indexOf(name));
                    run(dir, name);
                }
            } catch (e) {
                alert(e);
                alert("项目库客户端在本机未安装");

            }
        }
        function run(directory, command) {
            try {
                var shell = new ActiveXObject("WScript.shell");
                if (shell) {
                    shell.CurrentDirectory = directory;
                    shell.exec(command);
                }
            } catch (e) {
                alert(e);

            }
        }
    </script>
</head>
<body>
    <form id="form1" runat="server">
    <div id="pageloading">
    </div>
    <div id="img" style="left: 27px; visibility: hidden; position: absolute; top: 1115px;
        z-index: 1000">
        <a href="#" target="_blank">
            <img border="0" src="Styles/skins/Ad/示例.jpg" width="80" height="80">
        </a><a href="javascript:closeDiv();" style="color: Black; position: absolute; right: -25px;
            top: 1px; font-size:small">关闭</a>
    </div>
    <script language="javascript"> 
<!--        Begin
        var xPos = 20;
        var yPos = document.body.clientHeight;
        var step = 1;
        var delay = 30;
        var height = 0;
        var Hoffset = 0;
        var Woffset = 0;
        var yon = 0;
        var xon = 0;
        var pause = true;
        var interval;
        img.style.top = yPos;
        var AdSwitch = "<%=AdSwitch %>";
        if (AdSwitch == 1) {
            start();
        }
        function changePos() {
            width = document.body.clientWidth;
            height = document.body.clientHeight;
            Hoffset = img.offsetHeight;
            Woffset = img.offsetWidth;
            img.style.left = xPos + document.body.scrollLeft;
            img.style.top = yPos + document.body.scrollTop;
            if (yon) {
                yPos = yPos + step;
            }
            else {
                yPos = yPos - step;
            }
            if (yPos < 0) {
                yon = 1;
                yPos = 0;
            }
            if (yPos >= (height - Hoffset)) {
                yon = 0;
                yPos = (height - Hoffset);
            }
            if (xon) {
                xPos = xPos + step;
            }
            else {
                xPos = xPos - step;
            }
            if (xPos < 0) {
                xon = 1;
                xPos = 0;
            }
            if (xPos >= (width - Woffset)) {
                xon = 0;
                xPos = (width - Woffset);
            }
        }
        function start() {
            img.style.visibility = "visible";
            interval = setInterval('changePos()', delay);
        }
        function closeDiv() {
            img.style.visibility = "hidden";
        }
         
// End --> 
    </script>
    <telerik:RadScriptManager ID="RadScriptManager1" runat="server">
    </telerik:RadScriptManager>
    <div class="top">
        <span></span>
    </div>
    <div class="menu">
        <div class="menuleft">
            <ul>
                <li>登陆账号：<asp:Literal runat="server" ID="ltrLoginUser"></asp:Literal></li>
                <li runat="server" id="liUserName">用户名称：<asp:Literal runat="server" ID="ltrLoginName"></asp:Literal></li>
                <li runat="server" id="liUserInfo" visible="false">用户类型：<asp:Literal runat="server"
                    ID="ltrLoginCorpType"></asp:Literal></li>
                <li runat="server" id="liMarkinfo" visible="false">当前市场：<asp:Literal runat="server"
                    ID="ltrCurrentMarket"></asp:Literal></li>
            </ul>
        </div>
        <div class="menuright">
            <ul>
                <li runat="server" id="liexit"><a class="exit_tt_m" href="#" title="退出">退出</a></li>
                <li runat="server" id="liqq"><a class="a_qq" href="#" title="帮助">QQ在线</a></li>
                <li runat="server" id="lihelp"><a class="help_tt_m" onclick="addTabExtend(this,'AccountHelp/Help.aspx','帮助')"
                    href="#" title="帮助">帮助</a></li>
                <%--<li><a class="set_tt_m" onclick="addTabExtend(this,'AccountHelp/UserInfo.aspx','设置')" href="#" title="设置">用户设置</a></li>--%>
                <li runat="server" id="liuser"><a class="set_tt_m" onclick="addTabExtend(this,'AccountHelp/UserInfo.aspx','用户信息')"
                    href="#" title="用户信息">用户信息</a></li>
                <li id="line-li">
                    <img src="images/line.png" width="1" height="17" /></li>
                <li runat="server" id="liforward"><a href="javascript:navFrame(1);" class="houtui_tt_m"
                    title="向前">向前</a></li>
                <li runat="server" id="liback"><a href="javascript:navFrame(-1);" class="qianjin_tt_m"
                    title="向后">向后</a></li>
            </ul>
        </div>
    </div>
    <div id="layout1" style="width: 99.2%; margin: 0 auto; margin-top: 4px;">
        <div position="left" title="功能菜单" id="accordion1">
            <div title="" class="l-scroll">
                <ul id="tree1" style="margin-top: 3px;">
                    <div id="wrapper-250">
                        <ul class="accordion" id='menu'>
                        </ul>
                    </div>
                </ul>
            </div>
        </div>
        <div position="center" id="framecenter">
            <div tabid="home" title="首页">
                <iframe frameborder="0" name="home" id="home" src="Main.aspx"></iframe>
            </div>
        </div>
    </div>
    <div id="utext" style="display: none;">
        <div class="meg">
            <div class="meg_l">
                <h3>
                    用户名:</h3>
                <span><strong>企业名称：</strong><asp:Literal runat="server" ID="ltrLoginCorpName"></asp:Literal></span><br />
                <span><strong>企业类型：</strong></span>
                <div class="market_area">
                    <span class="fl">当前市场：</span><span class="area"></span>
                    <div class="clear">
                    </div>
                </div>
            </div>
            <div class="meg_r">
            </div>
        </div>
    </div>
    </form>
    <div id="divQQ" style="z-index: 999; right: 40px; visibility: visible; width: 76px;
        position: absolute; top: 200px; height: 203px; display: none;">
        <table width="100" border="0" cellspacing="0" cellpadding="0">
            <tr>
                <td colspan="3" style="font-size: 0px;">
                    <img src="Images/QQ_3.gif" width="106" height="71" border="0" usemap="#Map">
                </td>
            </tr>
            <tr>
                <td width="4" height="78" background="images/QQ_8.gif">
                </td>
                <td width="98" align="center" bgcolor="#FFFFFF">
                    <table width="100%" cellspacing="0" cellpadding="3" class="tab">
                        <tr>
                            <td width="36%" height="22">
                                <div align="center">
                                    <img src="http://wpa.qq.com/pa?p=1:1215554807:4" border='0' width="22" height="17"></div>
                            </td>
                            <td width="64%" height="22">
                                <a href="http://wpa.qq.com/msgrd?V=1&amp;Uin=1215554807&amp;Site=QQ咨询&amp;Menu=yes"
                                    target='_blank'>QQ客服1</a>
                            </td>
                        </tr>
                        <tr>
                            <td height="22">
                                <div align="center">
                                    <img src="http://wpa.qq.com/pa?p=1:2385016278:4" border='0' width="22" height="17"></div>
                            </td>
                            <td height="22">
                                <a href="http://wpa.qq.com/msgrd?V=1&amp;Uin=2385016278&amp;Site=QQ咨询&amp;Menu=yes"
                                    target='_blank'>QQ客服2</a>
                            </td>
                        </tr>
                        <tr>
                            <td height="22">
                                <div align="center">
                                    <img src="http://wpa.qq.com/pa?p=1:1731434335:4" border='0' width="22" height="17"></div>
                            </td>
                            <td height="22">
                                <a href="http://wpa.qq.com/msgrd?V=1&amp;Uin=1731434335&amp;Site=QQ咨询&amp;Menu=yes"
                                    target='_blank'>QQ客服3</a>
                            </td>
                        </tr>
                    </table>
                </td>
                <td width="4" background="Images/QQ_7.gif">
                </td>
            </tr>
            <tr>
                <td colspan="3">
                    <img src="Images/QQ_12.gif" width="106" height="44">
                </td>
            </tr>
        </table>
    </div>
    <map name="Map" id="Map">
        <area shape="poly" coords="78,3,82,17,90,18,97,13,98,8,98,3,77,3" href="javascript:"
            onclick="divQQ.style.display='none';" title="关闭" />
    </map>
    <script src="Scripts/LoadSysAnnouncement.js"></script>
    <center>
        <noscript>
            <a href="http://www.51.la/?17099392" target="_blank">
            <img alt="&#x6211;&#x8981;&#x5566;&#x514D;&#x8D39;&#x7EDF;&#x8BA1;" src="http://img.users.51.la/17099392.asp" style="border:none" />
            </a>
        </noscript>
    </center>
</body>
</html>
